package com.delio.client.util;

import com.extjs.gxt.ui.client.widget.LayoutContainer;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.layout.ColumnData;
import com.extjs.gxt.ui.client.widget.layout.ColumnLayout;
import com.extjs.gxt.ui.client.widget.layout.FormData;
import com.extjs.gxt.ui.client.widget.layout.FormLayout;
import com.google.gwt.user.client.ui.Widget;

public class ColumnField extends LayoutContainer{

	public ColumnField() {
		setLayout(new ColumnLayout());
	}

	public void setDerechaTop(Widget w, FormData fd) {
		LayoutContainer right = new LayoutContainer();

		FormLayout layout = new FormLayout();
		layout.setLabelAlign(LabelAlign.TOP);
		right.setLayout(layout);

		right.add(w, fd);

		add(right, new ColumnData(.5));

	}

	public void setIzquierdaTop(Widget w, FormData fd) {
		LayoutContainer left = new LayoutContainer();

		FormLayout layout = new FormLayout();
		layout.setLabelAlign(LabelAlign.TOP);
		left.setLayout(layout);

		left.add(w, fd);

		add(left, new ColumnData(.5));

	}

	public void setDerecha(Widget w, FormData fd) {
		LayoutContainer right = new LayoutContainer();

		FormLayout layout = new FormLayout();
		layout.setLabelAlign(LabelAlign.LEFT);
		layout.setLabelWidth(40);

		right.setLayout(layout);

		right.add(w, fd);

		add(right, new ColumnData(.5));

	}

	public void setIzquierda(Widget w, FormData fd) {
		LayoutContainer left = new LayoutContainer();

		FormLayout layout = new FormLayout();
		layout.setLabelAlign(LabelAlign.LEFT);
		layout.setLabelWidth(40);

		left.setLayout(layout);

		left.add(w, fd);

		add(left, new ColumnData(.5));

	}
}
